<template>
  <div class="card">
    <div class="card-header">
      <div>主标题</div>
      <div>副标题</div>
    </div>
    <div class="card-content" v-if="content">{{ content }}</div>
  </div>
</template>
<script setup lang="ts">
interface Props {
  content?: string
}
defineProps<Props>()
</script>
<style scoped lang="less">
// less 中定义和使用变量，利用 @
@border: #ccc;
.card {
  margin: 10px;
  border: 1px solid @border;
  // less 中嵌套选择引用外层选择器，利用 &
  &:hover {
    box-shadow: 0 0 10px #ccc;
  }
  &-header {
    border-bottom: 1px solid @border;
    display: flex;
    padding: 10px;
    justify-content: space-between;
  }
  &-content {
    padding: 10px;
  }
}
</style>
